Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bad logical operator test for setting expireAfterSeconds option… #78

Merged
merged 1 commit into from Dec 11, 2016

Conversation

jaydub2099
Copy link
Contributor

I was trying to implement the new expireAfterSeconds option to winston-mongodb and the TTL index was not created on any of my logging collections, even if I dropped the collections and let winston-mongodb recreate them. I believe that the problem is that despite the docs saying that the expireAfterSeconds option only is in play if the capped option is NOT set, the code for setting the expireAfterSeconds option actually has a logical operator test that checks if 'this.capped && options.expireAfterSeconds'. With that test, if capped is set as false or false via default, then the expireAfterSeconds option is actually not evaluated.

I tested simply changing this.capped to !this.capped and the result was successful creation of my logging collections with the TTL index.

Note I am testing on 1.6.5 since we are not ready to move to node 6.x but the change is a one liner and so should apply just the same on the 2.x version.

@yurijmikhalevich yurijmikhalevich merged commit 93b396d into winstonjs:master Dec 11, 2016
@yurijmikhalevich
Copy link
Member

Thank you. Merged. Released in 1.6.6 and 2.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants